<template>
  <XmSelect ref="xmSelect" v-model="inputValue" :options="list" v-bind="{
    ...$attrs,
    placeholder: $attrs.placeholder || '请选择'
  }" v-on="$listeners">
  </XmSelect>
</template>

<script>
import inputValueMixin from '@/mixins/inputValueMixin'
import {
  getOrderChannelList //渠道
} from "@/api/createOrder";

export default {
  name: 'ChannelSelect',
  mixins: [inputValueMixin],
  props: {
  },
  data() {
    return {
      list: []
    };
  },
  methods: {
    getList(channelTypeId) {
      getOrderChannelList({
        parentId: channelTypeId
      }).then(res => {
        this.list = (res.data.data || []).map(item => {
          return {
            ...item,
            label: item.channelName,
            value: item.channelKey
          }
        })
        this.$emit('loadedList', this.list)
      });
    },
    getSelectedLabel() {
      return this.$refs.xmSelect && this.$refs.xmSelect.getSelectedLabel();
    },
    getSelectedItem() {
      return this.$refs.xmSelect && this.$refs.xmSelect.getSelectedItem();
    }
  },
  created() {
  }
};
</script>

<style scoped lang="scss">
</style>
